using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableHeroInfoDao:DaoBase<TableHeroInfo>
    {
        public override void AddPrimaryIndex(TableHeroInfo model)
        {
            cachePrimary[model.id.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableHeroInfo.txt";
        }

        protected override TableHeroInfo ParseRowData(string[] rowData)
        {
            TableHeroInfo data = new TableHeroInfo();
			data.id = rowData [0];

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.width = 0;
            }
            else
            {
                data.width = int.Parse(rowData[1]);
            }

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.height = 0;
            }
            else
            {
                data.height = int.Parse(rowData[2]);
            }

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.x_left = 0;
            }
            else
            {
                data.x_left = int.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.y_top = 0;
            }
            else
            {
                data.y_top = int.Parse(rowData[4]);
            }

            return data;
        }



    }

}
